//This funciton will clone an object in a middle deep sense.
//Currently if the source object contains
//  Arrays
//  Functions
//  Vars
//
//How to use
//
//Example#1
//function Apple () {
//    this.color = "red";
//	  this.array = ["a","b"];
//    this.test = function() {
//       return this.color + ' apple';
//    }
//}
//var obj1 = new Apple();
//var obj2 = new cloneObject(obj1);
//
//Example#2
//var Apple2 = {
//    color: "red",
//	  this.array = ["a","b"];
//    getInfo: function () {
//        return this.color + ' apple';
//    }
//}
//var obj22 = new cloneObject(Apple2);
//
//Example#3
//var Apple3 = new function() {
//    this.color = "red";
//	  this.array = ["a","b"];
//    this.getInfo = function () {
//        return this.color + ' apple';
//    };
//}
//
//var obj23 = new cloneObject(Apple3);


function cloneObject(source) {
    for (i in source) {
        if (typeof source[i] == 'source') {
            this[i] = new cloneObject(source[i]);
        }
		else if(source[i] instanceof Array) {
			this[i] = source[i].slice();
		}
        else{
            this[i] = source[i];
		}
    }
}

//Source: http://www.codelifter.com/main/javascript/capturemouseposition1.html
//Capturing The Mouse Position in IE4-6 & NS4-6
//(C) 2000 www.CodeLifter.com
//Free for all users, but leave in this  header

var mouseX;
var mouseY;


function getMouseXY(e) {
    if (IE) { // grab the x-y pos.s if browser is IE
        mouseX = event.clientX + document.body.scrollLeft
        mouseY = event.clientY + document.body.scrollTop
    } else {  // grab the x-y pos.s if browser is NS
        mouseX = e.pageX
        mouseY = e.pageY
    }
    // catch possible negative values in NS4
    if (mouseX < 0) { mouseX = 0 }
    if (mouseY < 0) { mouseY = 0 }
    return true
}



